% \href{}{
% \href{}{
% \href{}{
% \href{}{

% author: keith cascio
% since:  20100114

\documentclass[10pt]{report}

\newcommand{\samiamversion}{3.0}
\newcommand{\samiamversionfylename}{30}
\newcommand{\javaxmx}{512}
\newcommand{\preparer}{Keith Girolamo Cascio}
% legal values: linux32, linux64, mac32, solaris32, windows32, windows64
\newcommand{\platform}{windows32}

\usepackage{ifthen}
\usepackage{xifthen}

\newboolean{instructldlibrarypath}
\setboolean{instructldlibrarypath}{false}

\ifthenelse{\equal{solaris32}{\platform}}{
  \newcommand{\architecture}{sparc}
  \newcommand{\operatingsystem}{Solaris}
  \newcommand{\fylenamecallsmile}{libcallsmile.so}
  \newcommand{\fylenameprofiler}{libcalljvmti.so}
  \newcommand{\fileseparator}{/}
  \newcommand{\pathjavaexe}{{\fileseparator}usr{\fileseparator}jdk{\fileseparator}latest{\fileseparator}bin{\fileseparator}java}
  \newcommand{\fylenamerunscript}{runsamiam}
  \newcommand{\fylenamedownload}{samiam{\samiamversionfylename}\_solaris\_{\architecture}.tar.gz}
  \newcommand{\TAR}{gnutar}
}

\ifthenelse{\equal{mac32}{\platform}}{
  \newcommand{\architecture}{i386}
  \newcommand{\operatingsystem}{Mac OS X}
  \newcommand{\fylenamecallsmile}{libcallsmile.jnilib}
  \newcommand{\fylenameprofiler}{libcalljvmti.jnilib}
  \newcommand{\fileseparator}{/}
  \newcommand{\pathjavaexe}{{\fileseparator}usr{\fileseparator}bin{\fileseparator}java}
  \newcommand{\fylenamerunscript}{runsamiam}
  \newcommand{\fylenamedownload}{samiam{\samiamversionfylename}\_macosx\_{\architecture}.tar.gz}
  \newcommand{\TAR}{tar}
}

\ifthenelse{\equal{linux64}{\platform}}{
  \newcommand{\architecture}{amd64}
}

\ifthenelse{\equal{linux32}{\platform}}{
  \newcommand{\architecture}{i386}
}

\ifthenelse{\equal{linux64}{\platform} \OR \equal{linux32}{\platform}}{
  \newcommand{\operatingsystem}{Linux}
  \newcommand{\fylenamecallsmile}{libcallsmile.so}
  \newcommand{\fylenameprofiler}{libcalljvmti.so}
  \newcommand{\fileseparator}{/}
  \newcommand{\pathjavaexe}{{\fileseparator}usr{\fileseparator}bin{\fileseparator}java}
  \newcommand{\fylenamerunscript}{runsamiam}
  \newcommand{\fylenamedownload}{samiam{\samiamversionfylename}\_linux\_{\architecture}.tar.gz}
  \newcommand{\TAR}{tar}
}

\ifthenelse{\equal{windows64}{\platform}}{
  \newcommand{\architecture}{amd64}
  \newcommand{\fylenamedownload}{samiam{\samiamversionfylename}\_windows\_{\architecture}.zip}
}

\ifthenelse{\equal{windows32}{\platform}}{
  \newcommand{\architecture}{i386}
  \newcommand{\fylenamedownload}{samiam{\samiamversionfylename}\_windows\_{\architecture}.zip}
}

\ifthenelse{\equal{windows64}{\platform} \OR \equal{windows32}{\platform}}{
  \newcommand{\operatingsystem}{Windows}
  \newcommand{\fylenamecallsmile}{callsmile.dll}
  \newcommand{\fylenameprofiler}{calljvmti.dll}
  \newcommand{\fileseparator}{\textbackslash}
  \newcommand{\pathjavaexe}{C:{\fileseparator}Windows{\fileseparator}System32{\fileseparator}java.exe}
  \newcommand{\fylenamerunscript}{samiam.bat}
  \newcommand{\scriptdescription}{an MS DOS executable}
  \newcommand{\librarydescription}{an MS Windows dynamic link}
  \newcommand{\instructionsunzip}{\begin{enumerate}[itemsep=0pt,topsep=0mm,label=\arabic*)]
\parskip     2pt
\item Open \texttt{{\fylenamedownload}} using the Windows utility \href{http://www.7-zip.org}{7-zip}.
\item Extract the contents of \texttt{{\fylenamedownload}} into a folder you choose.
\end{enumerate}}
   \newcommand{\instructionsrun}{To run under Windows:
\parskip     4pt
\begin{enumerate}[itemsep=0pt,topsep=0mm,label=\arabic*)]
\parskip     2pt
\item Double-click the icon for {\textquotedblleft}\texttt{{\fylenamerunscript}}{\textquotedblright}.
\end{enumerate}
\parskip     8pt

To run from an MS DOS shell:
\parskip     4pt
\begin{enumerate}[itemsep=0pt,topsep=0mm,label=\arabic*)]
\parskip     2pt
\item Change to the directory into which you have copied the SamIam files.
\item Execute the command {\textquotedblleft}\texttt{samiam}{\textquotedblright}.
\end{enumerate}}
}{
  \newcommand{\scriptdescription}{a shell}
  \newcommand{\librarydescription}{a {\operatingsystem} shared object}
  \newcommand{\instructionsunzip}{\parskip     4pt
\begin{enumerate}[itemsep=0pt,topsep=0mm,label=\arabic*)]
\parskip     2pt
\item Change to the directory that contains the file \texttt{{\fylenamedownload}}
\item Execute the command {\textquotedblleft}\texttt{{\TAR} xzf {\fylenamedownload}}{\textquotedblright}
\end{enumerate}}
  \newcommand{\instructionsrun}{To run SamIam:
\parskip     4pt
\begin{enumerate}[itemsep=0pt,topsep=0mm,label=\arabic*)]
\parskip     2pt
\item Change to the SamIam installation directory, {\textquotedblleft}\texttt{samiam{\fileseparator}}{\textquotedblright}
\item Execute the command {\textquotedblleft}\texttt{.{\fileseparator}{\fylenamerunscript}}{\textquotedblright}
\end{enumerate}}
}

\newcommand{\librarynames}{\texttt{{\fylenamecallsmile}}, \texttt{{\fylenameprofiler}}}

% Refreshing the TeX Database (mktexlsr) http://theoval.sys.uea.ac.uk/~nlct/latex/novices/refresh.html
% http://tug.ctan.org/tex-archive/macros/latex/contrib/datetime
% http://tug.ctan.org/tex-archive/macros/latex/contrib/fmtcount (dependency)
% for "created" watermark
\usepackage[nodate]{datetime}
%\usepackage{datetime}
%\newdateformat{wikipediadate}{\monthname\_\twodigit{\THEDAY}}

% for coloring explicit hyperlinks
\usepackage[usenames]{color}

% for underlining explicit hyperlinks
% \usepackage[normalem]{ulem}

% for margins
\usepackage[left=1.0in,top=0.5in,right=1.0in,bottom=0.5in,nohead,nofoot]{geometry}

% http://www.tex-tipografia.com/enumitem.html
% in order to control outline-style/bulleted lists
\usepackage{enumitem}

% Install TTF font in CentOS
% http://www.sokha.net/index.php?option=com_content&task=view&id=26&Itemid=9
%
% check if directory /usr/share/fonts/TTF exists, create it if not exist
% copy any *.TTF file font you want to install to /usr/share/fonts/TTF/ directory
% sudo /etc/init.d/xfs restart
%
\usepackage{fontspec}
%\setromanfont{Times New Roman}
\setromanfont{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont[Scale=0.8]{Liberation Mono}
% \usepackage{xunicode}

% to control hyphenation
% \usepackage{hyphenat}

% http://www.tug.org/applications/hyperref/manual.html
\usepackage[
colorlinks=true,
urlcolor=blue,
linkcolor=blue,
pdfborderstyle={/S/U/W 1},
linkbordercolor={.9 .9 .9},
 urlbordercolor={.1 .1 .7},
bookmarks=false,
pdftitle={Readme for SamIam Release {\samiamversion}},
pdfdisplaydoctitle=true,
pdfauthor={UCLA Automated Reasoning Group},
pdfsubject={SamIam: Sensitivity Analysis, Modelling, Inference and More},
pdfwindowui=true,
hyperindex=false,
plainpages=true
]{hyperref}

\parindent 0pt
\parskip   8pt
\parsep    0pt
\topsep    0pt
\partopsep 0pt

% suppress page numbers
% \pagestyle{empty}

% color of explicit external hyperlinks
% \definecolor{Blue}{rgb}{0,0,0.82}
% color of "watermark"
\definecolor{Watermark}{rgb}{0.98,0.98,0.98}

\begin{document}

\begin{center}
\fontsize{16}{22}\selectfont
\textbf{Readme for SamIam Release {\samiamversion}}
\end{center}

\fontsize{10}{12}\selectfont
\parskip  32pt
\textbf{Instructions:}
\parskip   8pt

This readme describes the {\operatingsystem} {\architecture} release of SamIam version {\samiamversion}.
The designation {\textquotedblleft}{\architecture}{\textquotedblright}
means that we compiled the supplementary libraries supplied with
this version ({\librarynames}) to run on {\architecture} architectures.
The principal part of SamIam is pure Java,
and therefore will run on any system with a Java Runtime Environment,
regardless of architecture.

SamIam was designed and tested to run with Java version 4 or newer,
but runs best with the latest Java Runtime Environment.
SamIam shows several advanced features only with JRE version 5 or newer.
On many {\operatingsystem} systems, the path to a Java executable is
{\textquotedblleft}\texttt{{\pathjavaexe}}{\textquotedblright}.

To unzip the file \texttt{{\fylenamedownload}}:
\parskip     4pt
{\instructionsunzip}
\parskip     8pt

{\instructionsrun}
\parskip     8pt

\textbf{For questions or feedback, contact:}
\parskip     0pt
\parindent  32pt

\hangindent=32pt SamIam Tech Support \\
\href{mailto:samiam@cs.ucla.edu}{samiam@cs.ucla.edu}
\parskip     8pt
\parindent   0pt

\textbf{List of all files:}
\begin{itemize}[noitemsep,topsep=0mm,leftmargin=*]
\item samiam.jar ^^^^2013 Java archive file needed to run SamIam.
\item inflib.jar ^^^^2013 Java archive file needed to run SamIam.  Also, a standalone inference library.
\item {\fylenamecallsmile} ^^^^2013 (optional) {\librarydescription} library ({\architecture} architecture) needed to open files of type .dsl, .xdsl, .dsc, .dne, and .erg in SamIam.
\item {\fylenameprofiler} ^^^^2013 (optional) {\librarydescription} library ({\architecture} architecture) needed for thread timing.
\item htmlhelp{\fileseparator} ^^^^2013 (optional) the directory containing the SamIam online help.
\item network\_samples{\fileseparator} ^^^^2013 (optional) this directory contains some example network files to get you started.
\item library\_javadocs{\fileseparator} ^^^^2013 (optional) this directory contains the API documentation for our standalone inference library \texttt{inflib.jar}.
\item {\fylenamerunscript} ^^^^2013 {\scriptdescription} script to invoke SamIam with increased memory allocation.
\item Readme for SamIam Release {\samiamversion} {\operatingsystem} {\architecture}.pdf ^^^^2013 this readme file.
\item samiamrc.xml ^^^^2013 the initialization file SamIam will create automatically the first time it runs.
\end{itemize}

\textbf{Advanced Instructions:}

\ifthenelse{\( \NOT \boolean{instructldlibrarypath} \) \OR \equal{windows64}{\platform} \OR \equal{windows32}{\platform}}{}{
\newcommand{\USERHOME}{{\fileseparator}home{\fileseparator}jane{\fileseparator}samiam{\fileseparator}}
To set up your {\operatingsystem} environment to run SamIam:
\begin{enumerate}[itemsep=0pt,topsep=0mm,label=\arabic*)]
\item Make sure the JRE (Java Runtime Environment) version 4 or later is installed. You can download it \href{http://java.sun.com/javase/downloads/index.jsp}{here}. To check the version you have installed, execute the command {\textquotedblleft}\texttt{java ^^^^2013version}{\textquotedblright}.
\item Make sure the executable program {\textquotedblleft}\texttt{java}{\textquotedblright} is in your path.\\
bash: {\textquotedblleft}\texttt{export PATH=.:\$PATH:{\pathjavaexe}}{\textquotedblright}\\
tcsh: {\textquotedblleft}\texttt{set path=( . {\pathjavaexe} \$path )}{\textquotedblright}
\item Set the environment variable \texttt{LD\_LIBRARY\_PATH} to point to your SamIam installation directory.\\
bash: {\textquotedblleft}\texttt{export LD\_LIBRARY\_PATH=\$LD\_LIBRARY\_PATH:{\USERHOME}}{\textquotedblright}\\
tcsh: {\textquotedblleft}\texttt{setenv LD\_LIBRARY\_PATH {\USERHOME}:\$LD\_LIBRARY\_PATH}{\textquotedblright}
\item Invoke SamIam by executing the command {\textquotedblleft}\texttt{.{\fileseparator}{\fylenamerunscript}}{\textquotedblright}
\end{enumerate}
}

To increase or decrease the memory available to SamIam:

We deliver SamIam with the invocation script
{\textquotedblleft}\texttt{{\fylenamerunscript}}{\textquotedblright} that passes necessary arguments to
the Java virtual machine. In particular, this run script passes the argument
{\textquoteleft}-Xmx{\textquoteright} to Java in
order to increase the maximum size of the runtime memory allocation pool to {\javaxmx} megabytes.
You may choose to edit your run script in order to increase or decrease the memory available to
Java. Java{\textquoteright}s default memory allocation, 64 megabytes, is insufficient to compile larger, more
complex networks. For more detailed instructions, please consult
\href{http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html#options}{Sun{\textquoteright}s documentation}.

\begin{flushright}
{\color{Watermark} Prepared by {\preparer}, \today \ \currenttime}
\end{flushright}

\end{document}
